{% extends "base.html" %}

{% block title %}添加收费项目{% endblock %}

{% block content %}
<div class="row">
    <div class="col-md-8 offset-md-2">
        <h2 class="mb-4">添加收费项目</h2>
        <form method="POST" onsubmit="return handleSubmit(this);">
            <div class="mb-3">
                <label for="name" class="form-label">项目名称</label>
                <input type="text" class="form-control" id="name" name="name" required>
            </div>
            <div class="mb-3">
                <label for="sort_order" class="form-label">排序</label>
                <input type="number" class="form-control" id="sort_order" name="sort_order" required>
            </div>
            <div class="mb-3">
                <button type="submit" class="btn btn-primary">提交</button>
                <button type="button" class="btn btn-secondary" onclick="window.close()">关闭</button>
            </div>
        </form>
    </div>
</div>

{% block scripts %}
<script>
function handleSubmit(form) {
    form.submit();
    // 通知父窗口刷新
    if (window.opener) {
        window.opener.postMessage('refresh', '*');
    }
    return false;
}
</script>
{% endblock %}
{% endblock %} 